import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login/index.vue'),
      meta: { title: '登录' }
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/Register/index.vue'),
      meta: { title: '注册' }
    },
    {
      path: '/account',
      name: 'account',
      component: () => import('@/views/Account/index.vue'),
      meta: { title: '账号' }
    },
    // 添加404页面路由
    {
      path: '/:pathMatch(.*)*',
      name: '404',
      component: () => import('@/views/NotFound/index.vue'),
      meta: { title: '404' }
    }
  ],
  scrollBehavior() {
    return { left: 0, top: 0 }
  }
})

export default router
